Format:
// binary module head:
LONG "DMOD"
WORD version, revision
// included modules:
LONG "MODS"
WORD count of modules
WHILE module
// each included module:
WORD StrLen(module.name)
CHAR module.name,0
EVEN
module:=module.next // get next module
ENDWHILE
// Constants:
LONG "CNST"
WORD count of constants
LONG data part length
// this is length in bytes of whole datatable of constants
LONG name list length
// this is length in bytes of all constant names including string terminating zeros
first:=constant // store first constant
WHILE constant
// known flags are currently:
// %001 - S_PRIVATE // for private constants
// %010 - S_INTERNAL // for internal constants, never use, only for internal powerd module writer
// %100 - S_TAG // needed only for tags
IF type=DOUBLE or FLOAT constant:
// DOUBLE/FLOAT constant:
UBYTE 8, flags
DOUBLE value
ELSEIF highword=$8000
// tag constant:
UBYTE 1, flags|%100
WORD lowword value
ELSEIF highword=$0000 or $ffff
// word constant (high-word=$0000 or $ffff):
UBYTE 3, flags
WORD low-word value
ELSEIF constant=0
// zero constant (constant=0):
UBYTE $ff,flags
ELSE
// constant (tag, word and zero constants can be used also here):
UBYTE 1, flags
LONG value
ENDIF
constant:=constant.next // get next constant
ENDWHILE
constant:=first // restore first constant
WHILE constant
CHAR constant.name,0
constant:=constant.next // get next constant
ENDWHILE
EVEN
LONG "OBJC"
LONG data length, name list length
WORD object count, item count
// LINK OPTions
LONG "LINK"
WORD count of links
WHILE link
WORD StrLen(link.name)
CHAR link.name,0
EVEN
link:=link.next // get next module
ENDWHILE
// HEAD OPTion
LONG "HEAD"
WORD StrLen(head.name)
CHAR head.name,0
EVEN